package com.iluwatar.doubleadapter;

/**
 * Created by Administrator on 2015/10/27.
 */
public class Computer {
    private HDMI mDisplayer;
    private VGA mVGA;
    private USB mKeyboard;

    public void plugInHDMIDisplayer(HDMI hdmi) {
        this.mDisplayer = hdmi;
    }

    public void plugInVGADisplayer(VGA vga) {
        this.mVGA = vga;
    }

    public void input(String text) {
        String content = mKeyboard.input(text);
        if (mDisplayer != null)
            mDisplayer.showHD(content);
        else if (mVGA != null)
            mVGA.show(content);
    }

    public void plugInKeyboard(USB usb) {
        this.mKeyboard = usb;
    }
}
